package com.stx.servlet.pay;

import com.stx.bean.Pay;
import com.stx.mapper.PayMapper;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
/*更新访客数据*/
@WebServlet(urlPatterns = {"/payUpdate"})
public class PayUpdateServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        String name = req.getParameter("name");
        String way = req.getParameter("way");
        String number = req.getParameter("number");
        String payTime = req.getParameter("payTime");
        Pay pay = new Pay(id,name,way,number,payTime);

        try {
            PayMapper.payUpdate(pay);
            resp.sendRedirect("/payList");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }

}
